<%@ page contentType="text/html; charset=utf-8" pageEncoding="utf-8" %>
<%@ page isELIgnored="false" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="f" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%@ taglib prefix="s" uri="http://stripes.sourceforge.net/stripes.tld" %>

<s:layout-render name="/frontend/layout.jsp">
    <s:layout-component name="content">
        <s:useActionBean beanclass="cz.muni.fi.pa165.travelagency.web.frontend.PackageTourActionBean" var="actionBean"/>
            <div id="package-tour-detail-box">

                <center>
                    <h2>
                        <c:out value="${actionBean.ptour.name}"/>
                    </h2>
                </center>
                
                <div><span class="pt-label">
                        <f:message key="ptour.destination"/>: </span>
                        <c:out value="${actionBean.ptour.destination}"/>
                </div>
                <div><span class="pt-label">
                        <f:message key="ptour.date"/>: </span>
                        <f:formatDate value="${actionBean.ptour.start}" pattern="dd. MM. yyyy" /> - <f:formatDate value="${actionBean.ptour.end}" pattern="dd. MM. yyyy" />
                </div>
                <div><span class="pt-label">
                        <f:message key="ptour.capacity"/>: </span>
                        <c:out value="${actionBean.ptour.capacity}"/>
                </div>
                <div><span class="pt-label">
                        <f:message key="ptour.description"/>: </span>
                        <c:out value="${actionBean.ptour.description}"/>
                </div>
                <div><span class="pt-label">
                        <f:message key="ptour.pricePerPerson"/>: </span>
                        <c:out value="${actionBean.ptour.pricePerPerson}"/>
                </div>
                
                <c:if test="${not empty actionBean.ptour.availableTours}">
                    <h3><f:message key="ptour.available-tours"/></h3>
                                    
                    <div id="package-tour-detail-tours">
                        <c:forEach items="${actionBean.ptour.availableTours}" var="tour">
                            <div><span class="pt-label">
                                    <f:message key="tour.name"/>: </span>
                                    <c:out value="${tour.name}"/>
                            </div>    
                            <div><span class="pt-label">
                                    <f:message key="tour.description"/>: </span>
                                    <c:out value="${tour.description}"/>
                            </div>  
                            <div>
                                <s:link beanclass="cz.muni.fi.pa165.travelagency.web.frontend.TourActionBean" event="detail"><s:param name="tour.id" value="${tour.id}"/><f:message key="tour.detail"/></s:link>
                            </div>
                        </c:forEach>
                    </div>
                </c:if>

                <div>
                    <s:link beanclass="cz.muni.fi.pa165.travelagency.web.frontend.OrderActionBean" event="create"><s:param name="package-tour.id" value="${actionBean.ptour.id}"/><f:message key="ptour.order"/></s:link>
                </div>

            </div>
    </s:layout-component>
</s:layout-render>
                